//
//  MeGradeViewController.m
//  ChinaA
//
//  Created by Mxionlly on 2018/11/12.
//  Copyright © 2018 Evan. All rights reserved.
//

#import "MeGradeViewController.h"
#import "taskUserManagerService.h"

@interface MeGradeViewController ()
@property (weak, nonatomic) IBOutlet UIButton *button;
@property (weak, nonatomic) IBOutlet UIButton *button1;
@property (weak, nonatomic) IBOutlet UIButton *button2;
@property (weak, nonatomic) IBOutlet UILabel *lbchina;

@end

@implementation MeGradeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"合伙人申请";
    [self changeHeadView];
    [self initUI];
}

-(void)initUI{
    self.lbchina.text = [NSString stringWithFormat:@"%@ china-A",[UserCenter shareCenter].user.Balance];
    self.button.layer.masksToBounds = YES;
    self.button.layer.borderWidth = 1.0f;
    self.button.layer.borderColor = [UIColor clearColor].CGColor;
    self.button.layer.cornerRadius = 13.f;
    self.button1.layer.masksToBounds = YES;
    self.button1.layer.borderWidth = 1.0f;
    self.button1.layer.borderColor = [UIColor clearColor].CGColor;
    self.button1.layer.cornerRadius = 13.f;
    self.button2.layer.masksToBounds = YES;
    self.button2.layer.borderWidth = 1.0f;
    self.button2.layer.borderColor = [UIColor clearColor].CGColor;
    self.button2.layer.cornerRadius = 13.f;
    [self.button addTarget:self action:@selector(applyAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.button1 addTarget:self action:@selector(applyAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.button2 addTarget:self action:@selector(applyAction:) forControlEvents:UIControlEventTouchUpInside];
}


-(void)applyAction:(UIButton *)sender
{
    NSString *assetPackageType = @"20140006";
    if (sender.tag == 0) {
        assetPackageType = @"20140004";
    }else if (sender.tag == 1){
        assetPackageType = @"20140005";
    }
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setField:assetPackageType value:@"assetPackageType"];
    [DKProgressHUD showLoading];
    [taskUserManagerService getPartnerApply:dict success:^(BaseModel *response, BOOL success) {
        [DKProgressHUD dismiss];
        if (success) {
            [DKProgressHUD showSuccess];
        }else{
            [[UIAlertController alloc] alertTitle:@"提示" alertMessage:response.message leftCancelTitle:nil leftCancel:nil rightTitle:@"确定" rightOK:^(UIAlertAction *action) {
                
            }];
        }
    } failture:^(NSError *error, NSString *strDescription) {
        [DKProgressHUD dismiss];
        [DKProgressHUD showErrorWithStatus:strDescription];
    }];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
